home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / etc / probemodem.sh < prev   
Linux/UNIX/POSIX Shell Script  |  1994-08-01  |  16KB  |  555 lines

  1. #! /bin/sh
  2. #    $Header: /usr/people/sam/fax/etc/RCS/probemodem.sh,v 1.14 1994/04/25 17:05:49 sam Rel $
  3. #
  4. # FlexFAX Facsimile Software
  5. #
  6. # Copyright (c) 1993, 1994 Sam Leffler
  7. # Copyright (c) 1993, 1994 Silicon Graphics, Inc.
  8. # Permission to use, copy, modify, distribute, and sell this software and 
  9. # its documentation for any purpose is hereby granted without fee, provided
  10. # that (i) the above copyright notices and this permission notice appear in
  11. # all copies of the software and related documentation, and (ii) the names of
  12. # Sam Leffler and Silicon Graphics may not be used in any advertising or
  13. # publicity relating to the software without the specific, prior written
  14. # permission of Sam Leffler and Silicon Graphics.
  15. # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  16. # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  17. # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  18. # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19. # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20. # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21. # WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  22. # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  23. # OF THIS SOFTWARE.
  24. #
  25.  
  26. #
  27. # probemodem [tty]
  28. #
  29. # This script probes a modem attached to a serial line and
  30. # reports the results of certain commands.
  31. #
  32. PATH=/bin:/usr/bin:/etc
  33. test -d /usr/ucb  && PATH=$PATH:/usr/ucb        # Sun and others
  34. test -d /usr/bsd  && PATH=$PATH:/usr/bsd        # Silicon Graphics
  35. test -d /usr/5bin && PATH=/usr/5bin:$PATH:/usr/etc    # Sun and others
  36. test -d /usr/sbin && PATH=/usr/sbin:$PATH        # 4.4BSD-derived
  37.  
  38. if [ -d /etc/saf ]; then
  39.     # uname -s is unreliable on svr4 as it can return the nodename
  40.     OS=svr4
  41. else
  42.     OS=`uname -s 2>/dev/null || echo unknown`    # system identification
  43. fi
  44. SPEEDS="76800 57600 38400 19200 9600 4800 2400 1200"    # set of speeds to try
  45. SPEED=
  46.  
  47. while [ x"$1" != x"" ] ; do
  48.     case $1 in
  49.     -os)    OS=$2; shift;;
  50.     -s)        SPEED=$2; shift;;
  51.     -*)        echo "Usage: $0 [-os OS] [-s SPEED] [ttyname]"; exit 1;;
  52.     *)        TTY=$1;;
  53.     esac
  54.     shift
  55. done
  56.  
  57. OUT=/tmp/addmodem$$        # temp file in which modem output is recorded
  58. LOCKDIR=/usr/spool/locks    # UUCP locking directory
  59. SPOOL=/usr/spool/fax        # top of fax spooling tree
  60. SVR4UULCKN=$SPOOL/bin/lockname    # SVR4 UUCP lock name construction program
  61. ONDELAY=$SPOOL/bin/ondelay    # prgm to open devices blocking on carrier
  62. CAT="cat -u"            # something to do unbuffered reads and writes
  63.  
  64. #
  65. # Figure out which brand of echo we have and define
  66. # prompt and printf shell functions accordingly.
  67. # Note that we assume that if the System V-style
  68. # echo is not present, then the BSD printf program
  69. # is available.
  70. #
  71. if [ `echo foo\\\c`@ = "foo@" ]; then
  72.     # System V-style echo supports \r
  73.     # and \c which is all that we need
  74.     prompt()
  75.     {
  76.        echo "$* \\c"
  77.     }
  78.     printf()
  79.     {
  80.        echo "$*\\c"
  81.     }
  82. elif [ "`echo -n foo`@" = "foo@" ]; then
  83.     # BSD-style echo; use echo -n to get
  84.     # a line without the trailing newline
  85.     prompt()
  86.     {
  87.        echo -n "$* "
  88.     }
  89. else
  90.     # something else; do without
  91.     prompt()
  92.     {
  93.     echo "$*"
  94.     }
  95. fi
  96. t=`printf hello` 2>/dev/null
  97. if [ "$t" != "hello" ]; then
  98.     echo "You don't seem to have a System V-style echo command"
  99.     echo "or a BSD-style printf command.  I'm bailing out..."
  100.     exit 1
  101. fi
  102.  
  103. #
  104. # If the killall program is not present on the system
  105. # cobble together a shell function to emulate the
  106. # functionality that we need.
  107. #
  108. (killall -l >/dev/null) 2>/dev/null || {
  109.     killall()
  110.     {
  111.     # NB: ps ax should give an error on System V, so we try it first!
  112.     pid="`ps ax 2>/dev/null | grep $2 | grep -v grep | awk '{print $1;}'`"
  113.     test "$pid" ||
  114.         pid="`ps -e | grep $2 | grep -v grep | awk '{print $2;}'`"
  115.     test "$pid" && kill $1 $pid; return
  116.     }
  117. }
  118.  
  119. while [ -z "$TTY" -o ! -c /dev/$TTY ]; do
  120.     if [ "$TTY" != "" ]; then
  121.     echo "/dev/$TTY is not a terminal device."
  122.     fi
  123.     prompt "Serial port that modem is connected to [$TTY]?"; read TTY
  124. done
  125.  
  126. if [ ! -d $LOCKDIR ]; then
  127.     prompt "Hmm, uucp lock files are not in \"$LOCKDIR\", where are they?"
  128.     read x
  129.     while [ ! -d $x ]; do
  130.     prompt "Nope, \"$x\" is not a directory; try again:"
  131.     read x
  132.     done
  133.     LOCKDIR=$x
  134. fi
  135.  
  136. #
  137. # Try to deduce if the tty devices are named in the SGI
  138. # sense (ttyd<port>, ttym<port>, and ttyf<port>) or the
  139. # way that everyone else seems to do it--tty<port>
  140. #
  141. # (I'm sure that someone will tell me there is another way as well.)
  142. #
  143. case "$OS" in
  144. IRIX)
  145.     PORT=`expr $TTY : 'tty.\(.*\)'`
  146.     for x in f m d; do
  147.     LOCKX="$LOCKX $LOCKDIR/LCK..tty$x${PORT}"
  148.     done
  149.     DEVS="/dev/ttyd${PORT} /dev/ttym${PORT} /dev/ttyf${PORT}"
  150.     #
  151.     # NB: we use ttyd* device names in the following
  152.     # work so that we are not stopped by a need for DCD.
  153.     #
  154.     tdev=/dev/ttyd${PORT}
  155.     #
  156.     # No current SGI equipment supports rates >38400
  157.     #
  158.     SPEEDS="38400 19200 9600 4800 2400 1200"
  159.     ;;
  160. BSDi|BSD/386|386bsd|386BSD)
  161.     PORT=`expr $TTY : 'com\(.*\)'`
  162.     LOCKX="$LOCKDIR/LCK..$TTY"
  163.     DEVS=/dev/$TTY
  164.     tdev=/dev/$TTY
  165.     ;;
  166. SunOS|Linux|ULTRIX|HP-UX|FreeBSD)
  167.     PORT=`expr $TTY : 'tty\(.*\)'`
  168.     LOCKX="$LOCKDIR/LCK..$TTY"
  169.     DEVS=/dev/$TTY
  170.     tdev=/dev/$TTY
  171.     ;;
  172. svr4)
  173.     PORT=`expr $TTY : 'term\/\(.*\)' \| $TTY`    # Usual
  174.     PORT=`expr $PORT : 'cua\/\(.*\)' \| $PORT`    # Solaris
  175.     PORT=`expr $PORT : 'tty\(.*\)' \| $PORT`    # Old-style
  176.     DEVS=/dev/$TTY
  177.     tdev=/dev/$TTY
  178.     LOCKX="$LOCKDIR/`$SVR4UULCKN $DEVS`" || {
  179.     echo "Sorry, I cannot determine the UUCP lock file name for $DEVS"
  180.     exit 1
  181.     }
  182.     ;;
  183. *)
  184.     echo "Beware, I am guessing the tty naming conventions on your system:"
  185.     PORT=`expr $TTY : 'tty\(.*\)'`;    echo "Serial port: $PORT"
  186.     LOCKX="$LOCKDIR/LCK..$TTY";        echo "UUCP lock file: $LOCKX"
  187.     DEVS=/dev/$TTY; tdev=/dev/$TTY;    echo "TTY device: $DEVS"
  188.     ;;
  189. esac
  190. DEVID="`echo $TTY | tr '/' '_'`"
  191. CONFIG=$CPATH.$DEVID
  192.  
  193. #
  194. # Check that device is not currently being used.
  195. #
  196. for x in $LOCKX; do
  197.     if [ -f $x ]; then
  198.     echo "Sorry, the device is currently in use by another program."
  199.     exit 1
  200.     fi
  201. done
  202.  
  203. #
  204. # Lock the device for later use when deducing the modem type.
  205. #
  206. JUNK="$LOCKX $OUT"
  207. trap "rm -f $JUNK; exit 1" 0 1 2 15
  208.  
  209. LOCKSTR=`expr "         $$" : '.*\(..........\)'`
  210. # lock the device by all of its names
  211. for x in $LOCKX; do
  212.     echo "$LOCKSTR" > $x
  213. done
  214. # zap any gettys or other users
  215. fuser -k $DEVS >/dev/null 2>&1 || {
  216.     cat<<EOF
  217. Hmm, there does not appear to be an fuser command on your machine.
  218. This means that I am unable to insure that all processes using the
  219. modem have been killed.  I will keep going, but beware that you may
  220. have competition for the modem.
  221. EOF
  222. }
  223.  
  224. cat<<EOF
  225.  
  226. Now we are going to probe the tty port.  This takes a few seconds,
  227. so be patient.  Note that if you do not have the modem cabled to
  228. the port, or the modem is turned off, this may hang (just go and
  229. cable up the modem or turn it on, or whatever).
  230. EOF
  231.  
  232. if [ $OS = "SunOS" ]; then
  233.     #
  234.     # Sun systems have a command for manipulating software
  235.     # carrier on a terminal line.  Set or reset carrier
  236.     # according to the type of tty device being used.
  237.     #
  238.     case $TTY in
  239.     tty*) ttysoftcar -y $TTY;;
  240.     cua*) ttysoftcar -n $TTY;;
  241.     esac
  242. fi
  243.  
  244. if [ -x ${ONDELAY} ]; then
  245.     onDev() {
  246.     if [ "$1" = "-c" ]; then
  247.         shift; catpid=`${ONDELAY} $tdev sh -c "$* >$OUT" & echo $!`
  248.     else
  249.         ${ONDELAY} $tdev sh -c "$*"
  250.     fi
  251.     }
  252. else
  253. cat<<'EOF'
  254.  
  255. The "ondelay" program to open the device without blocking is not
  256. present.  We're going to try to continue without it; let's hope that
  257. the serial port won't block waiting for carrier...
  258. EOF
  259.     onDev() {
  260.     if [ "$1" = "-c" ]; then
  261.         shift; catpid=`sh <$tdev >$tdev -c "$* >$OUT" & echo $!`
  262.     else
  263.         sh <$tdev >$tdev -c "$*"
  264.     fi
  265.     }
  266. fi
  267.  
  268. case $OS in
  269. *bsd*|*BSD*)    STTY="stty -f $tdev";;
  270. *)        STTY=stty;;
  271. esac
  272.  
  273. #
  274. # Send each command in SendString to the modem and collect
  275. # the result in $OUT.  Read this very carefully.  It's got
  276. # a lot of magic in it!
  277. #
  278. SendToModem()
  279. {
  280.     onDev $STTY 0                # reset the modem (hopefully)
  281.     onDev -c "$STTY clocal && exec $CAT $tdev"    # start listening for output
  282.     sleep 3                    # let listener open dev first
  283.     onDev $STTY -echo -icrnl -ixon -ixoff -isig clocal $SPEED; sleep 1
  284.     # NB: merging \r & ATQ0 causes some modems problems
  285.     printf "\r" >$tdev; sleep 1;        # force consistent state
  286.     printf "ATQ0V1E1\r" >$tdev; sleep 1;    # enable echo and result codes
  287.     for i in $*; do
  288.     printf "$i\r" >$tdev; sleep 1;
  289.     done
  290.     kill -9 $catpid; catpid=
  291.     # NB: [*&\\$] must have the "$" last for AIX (yech)
  292.     pat=`echo "$i"|sed -e 's/[*&\\\\$]/\\\\&/g'` # escape regex metacharacters
  293.     RESPONSE=`tr -d '\015' < $OUT | \
  294.     sed -n "/$pat/{n;s/ *$//;p;q;}" | sed 's/+F.*=//'`
  295. }
  296.  
  297. echo ""
  298. if [ -z "$SPEED" ]; then
  299.     #
  300.     # Probe for the highest speed at which the modem
  301.     # responds to "AT" with "OK".
  302.     #
  303.     printf "Probing for best speed to talk to modem:"
  304.     for SPEED in $SPEEDS
  305.     do
  306.     printf " $SPEED"
  307.     SendToModem "AT" >/dev/null 2>&1
  308.     sleep 1
  309.     RESULT=`tr -d "\015" < $OUT | tail -1`
  310.     test "$RESULT" = "OK" && break;
  311.     done
  312.     if [ "$RESULT" != "OK" ]; then
  313.     echo ""
  314.     echo "Unable to deduce DTE-DCE speed; check that you are using the"
  315.     echo "correct device and/or that your modem is setup properly.  If"
  316.     echo "all else fails, try the -s option to lock the speed."
  317.     exit 1
  318.     fi
  319.     echo " OK."
  320. else
  321.     echo "Using user-specified $SPEED to talk to modem."
  322. fi
  323. RESULT="";
  324. while [ -z "$RESULT" ]; do
  325.     #
  326.     # This goes in the background while we try to
  327.     # reset the modem.  If something goes wrong, it'll
  328.     # nag the user to check on the problem.
  329.     #
  330.     (trap 0 1 2 15;
  331.      while true; do
  332.     sleep 10;
  333.     echo ""
  334.     echo "Hmm, something seems to be hung, check your modem eh?"
  335.      done)& nagpid=$!
  336.     trap "rm -f \$JUNK; kill $nagpid \$catpid; exit 1" 0 1 2 15
  337.  
  338.     SendToModem "AT+FCLASS=?"             # ask for class support
  339.  
  340.     kill $nagpid
  341.     trap "rm -f $JUNK; test \"\$catpid\" && kill \$catpid; exit 1" 0 1 2 15
  342.     sleep 1
  343.  
  344.     RESULT=`tr -d "\015" < $OUT | tail -1`
  345.     if [ -z "$RESPONSE" ]; then
  346.     echo ""
  347.     echo "There was no response from the modem.  Perhaps the modem is"
  348.     echo "turned off or the cable between the modem and host is not"
  349.     echo "connected.  Please check the modem and hit a carriage return"
  350.     prompt "when you are ready to try again:"
  351.     read x
  352.     fi
  353. done
  354.  
  355. Try()
  356. {
  357.     onDev -c "$STTY clocal && exec $CAT $tdev"    # start listening for output
  358.     onDev $STTY -echo -icrnl -ixon -ixoff -isig clocal $SPEED; sleep 1
  359.     for i in $*; do
  360.     printf "$i\r" >$tdev; sleep 1;
  361.     done
  362.     kill -9 $catpid; catpid=
  363.     # NB: [*&\\$] must have the "$" last for AIX (yech)
  364.     pat=`echo "$i"|sed -e 's/[*&\\$]/\\\\&/g'`    # escape regex metacharacters
  365.     RESPONSE=`tr -d '\015' < $OUT | sed -n "/$pat/{n;s/ *$//;p;q;}"`
  366.     RESULT=`tr -d "\015" < $OUT | tail -1`
  367.  
  368.     printf "$*    RESULT = \"$RESULT\"    RESPONSE = \"$RESPONSE\"\n"
  369. }
  370.  
  371. TryClass2dot0Commands()
  372. {
  373.     Try "AT+FCLASS=?";    Try "AT+FCLASS?"
  374.     Try "AT+FCLASS=0";    Try "AT+FCLASS=1";    Try "AT+FCLASS=2.0"
  375.     Try "AT+FCLASS?"
  376.  
  377.     Try "AT+FJU=?";    Try "AT+FJU?"
  378.  
  379.     Try "AT+FDR=?"
  380.     Try "AT+FDT=?"
  381.     Try "AT+FIP=?"
  382.  
  383.     Try "AT+FAA=?";    Try "AT+FAA?"
  384.             Try "AT+FBS?"    # NB: +FBS is a read-only parameter
  385.     Try "AT+FBO=?";    Try "AT+FBO?"
  386.     Try "AT+FBU=?";    Try "AT+FBU?"
  387.     Try "AT+FCC=?";    Try "AT+FCC?"
  388.     Try "AT+FCQ=?";    Try "AT+FCQ?"
  389.     Try "AT+FCR=?";    Try "AT+FCR?"
  390.     Try "AT+FCS=?";    Try "AT+FCS?"
  391.     Try "AT+FCT=?";    Try "AT+FCT?"
  392.     Try "AT+FEA=?";    Try "AT+FEA?"
  393.     Try "AT+FFC=?";    Try "AT+FFC?"
  394.     Try "AT+FHS=?";    Try "AT+FHS?"
  395.     Try "AT+FIE=?";    Try "AT+FIE?"
  396.     Try "AT+FIS=?";    Try "AT+FIS?"
  397.     Try "AT+FLI=?";    Try "AT+FLI?"
  398.     Try "AT+FLO=?";    Try "AT+FLO?"
  399.     Try "AT+FLP=?";    Try "AT+FLP?"
  400.             Try "AT+FMI?"
  401.             Try "AT+FMM?"
  402.             Try "AT+FMR?"
  403.     Try "AT+FMS=?";    Try "AT+FMS?"
  404.     Try "AT+FNR=?";    Try "AT+FNR?"
  405.     Try "AT+FNS=?";    Try "AT+FNS?"
  406.     Try "AT+FPI=?";    Try "AT+FPI?"
  407.     Try "AT+FPP=?";    Try "AT+FPP?"
  408.     Try "AT+FPR=?";    Try "AT+FPR?"
  409.     Try "AT+FPS=?";    Try "AT+FPS?"
  410.     Try "AT+FRQ=?";    Try "AT+FRQ?"
  411.     Try "AT+FRY=?";    Try "AT+FRY?"
  412.     Try "AT+FSP=?";    Try "AT+FSP?"
  413.  
  414.     # NB: put this last since it resets to Class 0 on some modems
  415.     Try "AT+FKS=?"
  416. }
  417.  
  418. TryClass2Commands()
  419. {
  420.     Try "AT+FCLASS=?";    Try "AT+FCLASS?"
  421.     Try "AT+FCLASS=0";    Try "AT+FCLASS=1";    Try "AT+FCLASS=2"
  422.     Try "AT+FCLASS?"
  423.     Try "AT+FJUNK=?";    Try "AT+FJUNK?"
  424.     Try "AT+FAA=?";    Try "AT+FAA?"
  425.     Try "AT+FAXERR=?";    Try "AT+FAXERR?"
  426.     Try "AT+FBADLIN=?";    Try "AT+FBADLIN?"
  427.     Try "AT+FBADMUL=?";    Try "AT+FBADMUL?"
  428.     Try "AT+FBOR=?";    Try "AT+FBOR?"
  429.     Try "AT+FBUF=?";    Try "AT+FBUF?"
  430.     Try "AT+FBUG=?";    Try "AT+FBUG?"
  431.     Try "AT+FCIG=?";    Try "AT+FCIG?"
  432.     Try "AT+FCQ=?";    Try "AT+FCQ?"
  433.     Try "AT+FCR=?";    Try "AT+FCR?"
  434.     Try "AT+FTBC=?";    Try "AT+FTBC?"
  435.     Try "AT+FDCC=?";    Try "AT+FDCC?"
  436.     Try "AT+FDCS=?";    Try "AT+FDCS?"
  437.     Try "AT+FDIS=?";    Try "AT+FDIS?"
  438.     Try "AT+FDT=?";    Try "AT+FDT?"
  439.     Try "AT+FECM=?";    Try "AT+FECM?"
  440.     Try "AT+FET=?";    Try "AT+FET?"
  441.     Try "AT+FLID=?";    Try "AT+FLID?"
  442.     Try "AT+FLNFC=?";    Try "AT+FLNFC?"
  443.     Try "AT+FLPL=?";    Try "AT+FLPL?"
  444.     Try "AT+FMDL?";    Try "AT+FMFR?"
  445.     Try "AT+FMINSP=?";    Try "AT+FMINSP?"
  446.     Try "AT+FPHCTO=?";    Try "AT+FPHCTO?"
  447.     Try "AT+FPTS=?";    Try "AT+FPTS?"
  448.     Try "AT+FRBC=?";    Try "AT+FRBC?"
  449.     Try "AT+FREL=?";    Try "AT+FREL?"
  450.     Try "AT+FREV?";
  451.     Try "AT+FSPL=?";    Try "AT+FSPL?"
  452.     Try "AT+FTBC=?";    Try "AT+FTBC?"
  453.     Try "AT+FVRFC=?";    Try "AT+FVRFC?"
  454.     Try "AT+FWDFC=?";    Try "AT+FWDFC?"
  455.  
  456.     # NB: put this last since it resets to Class 0 on some modems
  457.     Try "AT+FK=?"
  458. }
  459.  
  460. TryClass1Commands()
  461. {
  462.     Try "AT+FCLASS=?";    Try "AT+FCLASS?"
  463.     Try "AT+FCLASS=0";    Try "AT+FCLASS=1"
  464.     Try "AT+FCLASS?"
  465.     Try "AT+FJUNK=?";    Try "AT+FJUNK?"
  466.     Try "AT+FAA=?";    Try "AT+FAA?"
  467.     Try "AT+FAE=?";    Try "AT+FAE?"
  468.     Try "AT+FTH=?"
  469.     Try "AT+FRH=?"
  470.     Try "AT+FTM=?"
  471.     Try "AT+FRM=?"
  472.     Try "AT+FTS=?"
  473.     Try "AT+FRS=?"
  474. }
  475.  
  476. TryCommonCommands()
  477. {
  478.     for i in 0 1 2 3; do
  479.     Try "ATI$i"
  480.     done
  481. }
  482.  
  483. common()
  484. {
  485.     echo "This looks like a Class $1 modem."
  486.     echo ""
  487.     TryCommonCommands
  488. }
  489.  
  490. class1()
  491. {
  492.     echo ""; echo "Class 1 stuff..."; echo ""
  493.     TryClass1Commands
  494. }
  495.  
  496. class2()
  497. {
  498.     echo ""; echo "Class 2 stuff..."; echo ""
  499.     TryClass2Commands
  500. }
  501.  
  502. class2dot0()
  503. {
  504.     echo ""; echo "Class 2.0 stuff..."; echo ""
  505.     TryClass2dot0Commands
  506. }
  507.  
  508. echo ""
  509. if [ "$RESULT" = "OK" ]; then
  510.     # Looks like a Class 1 or 2 modem, get more information
  511.     case "`echo $RESPONSE | sed -e 's/[()]//g'`" in
  512.     1)            common "1"; class1;;
  513.     2)            common "2"; class2;;
  514.     2.0)        common "2.0"; class2dot0;;
  515.     0,1)        common "1"; class1;;
  516.     0,2)        common "2"; class2;;
  517.     0,2.0)        common "2.0"; class2dot0;;
  518.     1,2)        common "1+2"; class1; class2;;
  519.     1,2.0)        common "1+2.0"; class1; class2dot0;;
  520.     2,2.0)        common "2+2.0"; class2; class2dot0;;
  521.     0,1,2)        common "1+2"; class1; class2;;
  522.     0,1,2.0)        common "1+2.0"; class1; class2dot0;;
  523.     0,2,2.0)        common "2+2.0"; class2; class2dot0;;
  524.     1,2,2.0)        common "1+2+2.0"; class1; class2; class2dot0;;
  525.     0,1,2,2.0)        common "1+2+2.0"; class1; class2; class2dot0;;
  526.     0,1,2,2.0,*)    common "1+2+2.0"; class1; class2; class2dot0;;
  527.     1,2,2.0,*)        common "1+2+2.0"; class1; class2; class2dot0;;
  528.     0,2,2.0,*)        common "2+2.0"; class2; class2dot0;;
  529.     0,1,2.0,*)        common "1+2.0"; class1; class2dot0;;
  530.     0,1,2,*)        common "1+2"; class1; class2;;
  531.     2,2.0,*)        common "2+2.0"; class2; class2dot0;;
  532.     1,2.0,*)        common "2+2.0"; class1; class2dot0;;
  533.     1,2,*)        common "1+2"; class1; class2;;
  534.     0,2.0,*)        common "2.0"; class2dot0;;
  535.     0,2,*)        common "2"; class2;;
  536.     0,1,*)        common "1"; class1;;
  537.     2.0,*)        common "2.0"; class2dot0;;
  538.     2,*)        common "2"; class2;;
  539.     1,*)        common "1"; class1;;
  540.     *)    echo "The result of the AT+FCLASS=? command was:"
  541.     echo ""
  542.     cat $OUT
  543.     echo ""
  544.     echo "I don't figure that it's worthwhile to continue..."
  545.     exit
  546.     ;;
  547.     esac
  548. else
  549.     echo "This not a Class 1, 2, or 2.0 modem,"
  550.     exit
  551. fi
  552.